package org.jeecg.modules.controller;

import com.google.gson.Gson;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.entity.DicXzqh;
import org.jeecg.modules.entity.InterfaceInfo;
import org.jeecg.modules.service.IInterfaceInfoService;
import org.jeecg.modules.utils.ApiUtil;
import org.jeecg.modules.utils.UrlUtil;
import org.jeecg.modules.vo.ParamsVo;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.io.InputStream;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 知识问答
 * @Author: nc
 * @Date: 2023/2/3 14:26
 * @Description:
 */
@Api(tags="5.知识问答控制层")
@RestController
@RequestMapping("/boot/knowController")
@Slf4j
public class KnowController {


    @Resource
    private IInterfaceInfoService interfaceInfoService;

    /**
     * 每日英语
     *
     * @param request
     * @return
     */
    @ApiOperation("每日英语")
    @RequestMapping(value = "/everyday", method = RequestMethod.POST)
    public Result<?> oilPrice(HttpServletRequest request) {
        Map<String,String> analysisStr = new HashMap<>();
        Map<String, String> urlMap = UrlUtil.everyday;
        try {
            Map<String , String> map = new HashMap<>();
            //格式化查询条件
            String content = ApiUtil.formatMap(urlMap, map);
            //查询接口
            analysisStr = interfaceInfoService.selectInterfaceInfo(content, urlMap, map);
        }catch (Exception e){
            e.printStackTrace();
        }

        return Result.ok(analysisStr);
    }
}
